package Java测试.编码8;

//8 求1+2!+3!+...+20!的和？//结果为268040729
public class Testcopycopy {
    public static void main(String[] args) {

        System.out.println("1+2!+3!+...+20!="+show(20));
    }
    public static int show(int a){
        int i,j,c,sum=0;
        for (i =1; i <=a; i++) {
            c=1;
            for (j =1; j <=i; j++)
                c=c*j;
                sum+=c;
        }return sum;
    }
}
